import { createRouter, createWebHashHistory } from 'vue-router'

import layout from '@/layout/index.vue'

const login = () => import("@/views/login/index.vue")
const PersonalIndex = () => import("@/views/personal/Index.vue")
const PersonalMessage = () => import("@/views/personal/Message.vue")
const AppIndex = () => import("@/views/app/Index.vue")

const NotFound = () => ("@/views/404.vue")

const router = createRouter({

    history: createWebHashHistory(),
    routes
})
const router= [
    {
        {
            path: '/',
            redirect: '/home',
            component: layout,
            children: [
                //登录页
                {
                path: 'login',
                name: 'login',
                component: login
            },
            //个人中心页
            {
                path:'personal',
                name:'Personal',
                component:PersonalIndex,
                children:[{
                    path:'message',
                    name:'PersonalMessage',
                    component:PersonalMessage
                }]
            },
            //App内部页
            {
                path:'app',
                name:'App',
                component:NotFound
            }
            ]
        },
        {
            path:'/:pathMatch(.*)*',
            name:'404',
            redirect:'/404'
        }
    }
]

//对外暴露实例化路由对象
export default router